﻿using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.PB;
using Coldairarrow.Util;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Business.PB
{
    public partial interface IPB_MaterialPriceBusiness
    {
        Task<PageResult<PB_MaterialPrice>> GetDataListAsync(PageInput<ConditionDTO> input);
        Task<PageResult<PB_MaterialPriceDTO>> GetDataListDTOAsync(PageInput<ConditionDTO> input);
        Task<PB_MaterialPrice> GetTheDataAsync(string id);
        Task AddDataAsync(PB_MaterialPrice data);
        Task UpdateDataAsync(PB_MaterialPrice data);
        Task DeleteDataAsync(List<string> ids);

        /// <summary>
        /// 保存计件单价
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task SaveMaterialPriceAsync(MaterialPriceDTO data);

        /// <summary>
        /// 调整计件单价
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task UpdateMaterialPriceAsync(MaterialPriceDTO data);

        /// <summary>
        /// 调整物料单价
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task UpdateLabourPriceAsync(MaterialPriceDTO data);

        /// <summary>
        /// 查询物料计件单价
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PageResult<MaterialPriceListDTO>> GetMaterialPriceListAsync(PageInput<MaterialPriceConditionDTO> input);

    }

    /// <summary>
    /// 保存计件单价使用
    /// </summary>
    public class MaterialPriceDTO
    {
        /// <summary>
        /// 组织Id
        /// </summary>
        public string Deptid { get; set; }

        /// <summary>
        /// 物料Id
        /// </summary>
        public string Materialid { get; set; }

        /// <summary>
        /// 工序Id
        /// </summary>
        public string ProcecureSubid { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public double? UnitPrice { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public string StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public string EndDate { get; set; }
        /// <summary>
        /// 计价方式
        /// </summary>
        public Boolean? PricingMethod { get; set; }

    }

    /// <summary>
    /// 查询物料计件单价
    /// </summary>
    public class MaterialPriceListDTO : PB_MaterialPrice
    {
        /// <summary>
        /// 物料名称
        /// </summary>
        public string MaterialName { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料规格
        /// </summary>
        public string MaterialSpec { get; set; }

        /// <summary>
        /// 组织名称
        /// </summary>
        public string DeptName { get; set; }

        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcecureSubName { get; set; }

    }

    /// <summary>
    /// 查询物料计件单价搜索条件
    /// </summary>
    public class MaterialPriceConditionDTO
    {
        public string Condition { get; set; }
        public string Keyword { get; set; }

        /// <summary>
        /// 工序Id
        /// </summary>
        public string ProcecureSubid { get; set; }

        /// <summary>
        /// 组织Id
        /// </summary>
        public string Deptid { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public string StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public string EndDate { get; set; }

    }

}